<?php
sfContext::getInstance()->getConfiguration()->loadHelpers('I18N');
class ContactForm extends sfForm{
	public function configure(){
		#
		
		$this->setWidgets(array(
				'full_name'			=> new sfWidgetFormInputText(),
				'email'					=> new sfWidgetFormInputText(),
				'phone_number'	=> new sfWidgetFormInputText(),	
				'subject'				=> new sfWidgetFormInputText(),
				'content'       => new sfWidgetFormTextarea(),
				'file_url'			=> new sfWidgetFormInputHidden(),
				'captcha'				=> new sfWidgetFormInput()
		));

		$this->setValidators(array(
				'full_name'       	=> new sfValidatorString(array('required' => true),array('required'=> __('contact-error-fullname'))),
				'email'       			=> new sfValidatorString(array('required' =>  true),array('required'=> __('contact-error-email'))),
				'phone_number'    	=> new sfValidatorString(array('required' => false)),
				'subject'       => new sfValidatorString(array('required' => true),array('required'=> __('contact-error-phonenumber'))),
				'content'       => new sfValidatorString(array('required' => true),array('required'=> __('contact-error-subject'))),
				'captcha'				=> new sfValidatorString(array('required'=> true),array('required'=> __('contact-error-content'))),
				'file_url'			=> new sfValidatorString(array('required' => false)),
		));
		parent::configure();
		/*
		 * Setting name of form
		*/
		$this->widgetSchema->setNameFormat('Contact[%s]');
		$this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);
	}
}
